The Document Object Model and JavaScript > Custom JavaScript controls > A Color Button Control for extensions

 

A Color Button Control for extensions

A Color Button Control lets you add a color picker interface to your extensions. You instantiate a color button using the existing HTML form input tag with the type attribute of the control set to "mmcolorbutton', and then provide the name and value attributes accordingly. The name attribute is the name of the color button. The value attribute is the current color value, represented as either a hexadecimal string or as a color name.

Here are some examples of the mmcolorbutton tag:

<input type="mmcolorbutton" name="colorbutton" value="#FF0000"> 
<input type="mmcolorbutton" name="colorbutton" value="teal"> 

A color button has one event, onChange, which is triggered when the color is changed.